<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:82:"D:\wamp\www\A1-project\tp5\public/../application/index\view\Register\register.html";i:1527769607;}*/ ?>
<!DOCTYPE html>
<html>
	<head lang="en">
		<meta charset="UTF-8">
		<title>注册</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="format-detection" content="telephone=no">
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />

		<link rel="stylesheet" href="/static/home/AmazeUI-2.4.2/assets/css/amazeui.min.css" />
		<link href="/static/home/css/dlstyle.css" rel="stylesheet" type="text/css">
		<script src="/static/home/AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
		<script src="/static/home/AmazeUI-2.4.2/assets/js/amazeui.min.js"></script>
		<style>
			.cur{
				border:1px solid red;
			}
		</style>
	</head>

	<body>

		<div class="login-boxtitle">
			<a href="home/demo.html"><img alt="" src="/static/home/images/aishang.png" /></a>
		</div>

		<div class="res-banner">
			<div class="res-main">
				<div class="login-banner-bg"><span></span><img src="/static/home/images/big.jpg" />
				</div>
				<div class="login-box">
					<div class="am-tabs" id="doc-my-tabs">
						<ul class="am-tabs-nav am-nav am-nav-tabs am-nav-justify">
							<li class="am-active"><a href="">邮箱注册</a></li>
							<li><a href="">手机号注册</a></li>
						</ul>

						<div class="am-tabs-bd">
							<div class="am-tab-panel am-active">
							<form method="post">	
							   	<div class="user-email">
									<label for="email"><i class="am-icon-envelope-o"></i></label>
									<input type="email" name="" id="email" placeholder="请输入邮箱账号">
	                 			</div>										
	                 			<div class="user-pass">
								    <label for="password"><i class="am-icon-lock"></i></label>
								    <input type="password" name="" id="password" placeholder="设置密码">
	                 			</div>										
                				<div class="user-pass">
								    <label for="passwordRepeat"><i class="am-icon-lock"></i></label>
								    <input type="password" name="" id="passwordRepeat" placeholder="确认密码">
                				</div>	
	                 		</form>
                 
							<div class="login-links">
								<label for="reader-me">
									<input id="reader-me" type="checkbox"> 点击表示您同意商城《服务协议》
								</label>
						  	</div>
								<div class="am-cf">
								<input type="submit" name="" value="注册" class="am-btn am-btn-primary am-btn-sm am-fl">
							</div>
						</div>

						<div class="am-tab-panel">
							<form method="post" action="/homeregister/doregister" id="form">
			                	<div class="user-phone">
									<label for="phone"><i class="am-icon-mobile-phone am-icon-md"></i></label>
									<input type="text" name="tel" placeholder="请输入手机号">
			                	</div>																			
			                	<div class="user-pass">
									<label for="password"><i class="am-icon-lock"></i></label>
									<input type="password" name="password" id="password" placeholder="设置密码">
			                	</div>										
			                	<div class="user-pass">
									<label for="passwordRepeat"><i class="am-icon-lock"></i></label>
									<input type="password" name="repassword" id="passwordRepeat" placeholder="确认密码">
			                	</div>	
								<div class="verification">
									<label for="code"><i class="am-icon-code-fork"></i></label>
									<input type="code" name="code" id="code" placeholder="请输入验证码">
									<a href="javascript:void(0)" class="btn" id="ss">获取</a>
								</div>
								<div class="am-cf">
									<input type="submit" name="" value="注册" class="am-btn am-btn-primary am-btn-sm am-fl">
								</div>
							</form>

							<div class="login-links">
								<label for="reader-me">
									<input id="reader-me" type="checkbox"> 点击表示您同意商城《服务协议》
								</label>
							</div>
							<!-- <div class="am-cf">
								<input type="submit" name="" value="注册" class="am-btn am-btn-primary am-btn-sm am-fl">
							</div> -->
							<hr>
						</div>
						<script>
							$(function() {
							    $('#doc-my-tabs').tabs();
							})
						</script>
					</div>
				</div>
			</div>
		</div>
			
			<?php echo widget("Cate/footer"); ?>
					</div>
	</body>

</html>
<script type="text/javascript">
	TEL = false;
	PASS = false;
	REPASS = false;
	CODE = false;
	//失去焦点事件
	//手机号码
	$("input[name='tel']").blur(function(){
		//获取手机号码
		tel=$(this).val();
		// 正则匹配
		// alert(tel);
		if(tel.match(/^1[34578]\d{9}$/)==null){
			TEL = false;
			alert("手机号码格式不符合");
		}else{
			//检测手机号码是否唯一
			//ajax
			$.get("/homeregister/checktel",{tel:tel},function(data){
				if(data==1){
					TEL = false;
					//号码已经存在
					alert("号码已经注册");
				}else{
					TEL = true;
				}
			});
		}
	});
	//密码
	$("input[name='password']").blur(function(){
		//获取密码
		password=$(this).val();
		// 正则匹配
		if(password.match(/^\w{6,8}$/)==null){
			PASS = false;
			alert("密码必须是6-8位任意数字字母下划线组成");
		}else{
			PASS = true;
		}
	});
	//重复密码
	$("input[name='repassword']").blur(function(){
		//获取宠物密码
		repassword=$(this).val();
		// 正则匹配
		if(repassword.match(/^\w{6,8}$/)==null){
			REPASS = false;
			alert("密码必须是6-8位任意数字字母下划线组成");
		}else{
			password=$("input[name='password']").val();
			if(password!==repassword){
				REPASS = false;
				alert("两次密码不一致");
			}else{
				REPASS = true;
			}
		}
	});
	//获取验证码
	$("#ss").click(function(){
		o=$(this);
		//获取手机号
		tel=$("input[name='tel']").val();
		// alert(p);
		//Ajax
		$.get("/homeregister/checkp",{tel:tel},function(data){
			// alert(data.code);
			//判断
			if(data.code==000000){
				// alert(data);
				//执行倒计时
				m=60;
				mytime=setInterval(function(){
					m--;
					//赋值给button
					o.html(m+"秒后重新发送");
					//把按钮禁用
					o.attr("disabled",true);
					//判断
					if(m==0){
						//清除定时器
						clearInterval(mytime);
						//赋值button
						o.html("重新发送");
						//按钮激活
						o.attr("disabled",false);
					}
				},1000);
			}
		},'json');
	});
	//校验验证码
	$("input[name='code']").blur(function(){
		//获取输入的校验码
		code = $(this).val();
		//ajax
		$.get("/homeregister/checkcode",{code:code},function(data){
			// alert(data);
			if(data==0){
				CODE = false;
				alert('验证码不正确');
			}else if(data==2){
				CODE = false;
				alert('验证码过期');
			}else{
				CODE = true;
			}
		});
	});
	//表单提交事件
	$("#form").submit(function(){
		if(TEL && PASS && REPASS && CODE){
			return true;
		}else{
			alert("请完善注册用户信息")
			return false;
		}
	});
</script>